//import axios from 'axios';
import axiosRequest from '@/utils/request'
import {apiAddressSettings} from '@/config/app.config';
import store from '@/store/index';
import {getCookie} from '@/utils/function';

export async function getName(){
	//await axios.get('');
	//
	return {
		name: 'xiaolong'
	};
};


// 获取录入记录
export async function getEnergyLists (params){
	let result = await axiosRequest.get(`${apiAddressSettings.getEnergyList}`, params);
	return result;
};


// 获取模糊匹配结果
export async function getSearchResults (license = ''){

	return await axiosRequest.get(`${apiAddressSettings.getSearchResults}`, {
		params:{
			license: license
		}
	});

};


export async function getBaseInformation(cid){
	return await axiosRequest.get(`${apiAddressSettings.getBaseInformation}`, {
		params:{
			cid: cid
		}
	});
};

// 添加录入记录
export async function addEnergyRecord (params){
	let result = await axiosRequest.post(`${apiAddressSettings.addEnergyRecord}`, params);
	return result;
};


//
export async function getEnergyDetail (){
	let result = await axiosRequest.get(`${apiAddressSettings.getEnergyDetail}`);
	return result;
};


//
export async function editEnergyRecord (){
	let result = await axiosRequest.get(`${apiAddressSettings.editEnergyRecord}`);
	return result;
};


//
export async function deleteEnergyRecord (){
	let result = await axiosRequest.get(`${apiAddressSettings.deleteEnergyRecord}`);
	return result;
};

// 获取验证列表
export async function getAcceptLists(params){
	return await axiosRequest.get(`${apiAddressSettings.getAcceptLists}`, {
		params: params
	})
};


// 获取验证详情
export async function getAcceptDetail(repair_id){
	return await axiosRequest.get(`${apiAddressSettings.getAcceptDetail}`,{
		params:{
			repair_id:repair_id
		}
	});

};


export async function getLogin(){
	let controll = 'liveapi';
	let page = 'index';
	//addons/wg_live/api/liveapi/3/1/
	return await axiosRequest.get(`index`,{
		params:{}
	});
};


// 获取用户信息
export async function getUserinfo(){
	return await axiosRequest.post(`${apiAddressSettings.getUserinfo}`);
};


// 获取频道列表
export async function getChannelList(){
	return await axiosRequest.post(`${apiAddressSettings.getChannelList}`);
};

// 获取直播间详情
export async function getLiveDetail(params){
  return await axiosRequest.post(`${apiAddressSettings.getLiveDetail}`+params.id);
};


// 获取token
export async function getAccessToken(){
	return await axiosRequest.get(`${apiAddressSettings.getAccessToken}`);
};

// 获取首页信息
export async function getIndexInfomation(page = 1){
	return await axiosRequest.post(`${apiAddressSettings.getIndexInfomation}`, {page: page});
}


// 获取首页分类下的直播间(话题)
export async function getCateLives(params = {page: 0, cateId: ''}){
	let url = params.cateId ? `${apiAddressSettings.getCateLives}/${params.cateId}` : `${apiAddressSettings.getCateLives}`;
	return await axiosRequest.post(url, {page: params.page});
};

// 获取首页分类下的直播间(频道)
export async function getCateChannels(page = 0){
	return await axiosRequest.post(`${apiAddressSettings.getCateChannels}`, {page: page});
};

// 获取首页分类下的直播间(小视频)
export async function getCateVideos(page = 0){
	return await axiosRequest.post(`${apiAddressSettings.getCateVideos}`, {page: page});
};

// 获取礼物列表
export async function getGiftLists(live_id){
	return await axiosRequest.post(`${apiAddressSettings.getGiftLists}`, {live_id: live_id});
};


// 添加评论
export async function addComment(params = {live_id: '', content_type: 1, is_reply: 0, to_id: '', to_user_id: ''}){
	return await axiosRequest.post(`${apiAddressSettings.addComment}`, params);
};

// 获取评论列表
export async function getCommentlist(params = {page: 1, page_num: 10}){
	return await axiosRequest.post(`${apiAddressSettings.getCommentlist}`, params);
};
